package com.ch.fastbuilder.common;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;

import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

public class InitAppContext extends HttpServlet {  
    
    /** 
     * Destruction of the servlet. <br> 
     */  
    public void destroy() {  
        super.destroy(); // Just puts "destroy" string in log  
        // Put your code here  
    }  
  
    /** 
     * Initialization of the servlet. <br> 
     * Init application and using it in class that named "SpringContextUtil". 
     *  
     * @throws ServletException 
     *             if an error occurs 
     */  
    public void init() throws ServletException {  
        // Put your code here  
        ApplicationContext appcontext = WebApplicationContextUtils  
                .getWebApplicationContext(this.getServletContext());  
        SpringContextUtil springcontext = new SpringContextUtil();  
        springcontext.setApplicationContext(appcontext);  
    }  
}
